package com.gupao.gupaoeduvippattern.pattern.observer.gper;

import org.junit.jupiter.api.Test;

/**
 * @author 大帅
 * @description
 * @date 2020-12-02
 */
public class TestDemo {

    @Test
    public void test1(){
        //创建被观察者对象
        GPer gper = GPer.getInstance();

        //创建观察者对象
        Teacher t1 = new Teacher("Tom");
        Teacher t2 = new Teacher("Jerry");

        gper.addObserver(t1);
        gper.addObserver(t2);

        //被观察者发布问题，所有的观察者都会搜索到
        Question question = new Question();
        question.setUserName("张三");
        question.setContent("设计模式包含哪一些？");
        gper.publishQuestion(question);



    }


}
